<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <script src="mobile-detect.js"></script>
</head>
<title>手机浏览器信息</title>

<body>
    <div style=" width:88%;margin:30px auto; color:blue;" id="div_html">
    </div>

    <script type="text/javascript">
        var s = "";
        s += " 网页可见区域宽：" + document.body.clientWidth + "<br />";
        s += " 网页可见区域高：" + document.body.clientHeight + "<br />";
        s += " 网页可见区域高/宽：" + document.body.clientHeight/document.body.clientWidth + "<br />";
		s +="<br />"
		s += " 屏幕分辨率的高：" + window.screen.height + "<br />";
        s += " 屏幕分辨率的宽：" + window.screen.width + "<br />";
        s += " 屏幕分辨率的高/宽：" + window.screen.height/window.screen.width + "<br />";
		s +="<br />"
        s += " 网页正文全文宽：" + document.body.scrollWidth + "<br />";
        s += " 网页正文全文高：" + document.body.scrollHeight + "<br />";
        s += " 网页被卷去的高(ff)：" + document.body.scrollTop + "<br />";
        s += " 网页被卷去的高(ie)：" + document.documentElement.scrollTop + "<br />";
        s += " 网页被卷去的左：" + document.body.scrollLeft + "<br />";
        s += " 网页正文部分上：" + window.screenTop + "<br />";
        s += " 网页正文部分左：" + window.screenLeft + "<br />";
        
        s += " 屏幕可用工作区高度：" + window.screen.availHeight + "<br />";
        s += " 屏幕可用工作区宽度：" + window.screen.availWidth + "<br />";
        s += " 你的屏幕设置是 " + window.screen.colorDepth + " 位彩色" + "<br />";
        s += " 你的屏幕设置 " + window.screen.deviceXDPI + " 像素/英寸" + "<br />";

        document.getElementById("div_html").innerHTML = s;
    </script>
    <script>
        //判断数组中是否包含某字符串  
        Array.prototype.contains = function (needle) {
            for (i in this) {
                if (this[i].indexOf(needle) > 0)
                    return i; 
            }
            return -1;
        }

        var device_type = navigator.userAgent;//获取userAgent信息  

        var md = new MobileDetect(device_type);//初始化mobile-detect  
        var os = md.os();//获取系统  
        var model = "";
        if (os == "iOS") {//ios系统的处理  
            os = md.os() + md.version("iPhone");
            model = md.mobile();
        } else if (os == "AndroidOS") {//Android系统的处理  
            os = md.os() + md.version("Android");
            var sss = device_type.split(";");
            var i = sss.contains("Build/");
            if (i > -1) {
                model = sss[i].substring(0, sss[i].indexOf("Build/"));
            }
        }
		document.write("<br/>")
        document.write(os + "   " + model);//打印到页面  
        //document.write(device_type)
    </script>
</body>

</html>